﻿using System;

using SecuritySwitch.Abstractions;
using SecuritySwitch.Configuration;
using SecuritySwitch.Evaluation;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SecuritySwitch.Tests
{
    /// <summary>
    /// A custom request implementation for testing
    /// </summary>
    public class TestCustomRequestEvaluator : RequestEvaluator
    {
        /// <summary>
        /// Looks for special paths and then failover to default implementation
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="requestPath"></param>
        /// <returns></returns>
        protected override RequestSecurity? EvaluateSecurityForPath(Settings settings, string requestPath)
        {
            if (requestPath.StartsWith("/secure/")) return RequestSecurity.Secure;
            if (requestPath.StartsWith("/insecure/")) return RequestSecurity.Insecure;
            if (requestPath.StartsWith("/ignore/")) return RequestSecurity.Ignore;
            return base.EvaluateSecurityForPath(settings, requestPath);
        }
    }
}
